#include "qrsagsmapflash.h"
#include "qgsmapsettings.h"
#include "qgsmaprendererparalleljob.h"

QRSAGSMapFlash::QRSAGSMapFlash(QgsMapCanvas *mapCanvas)
    : QgsMapCanvasItem(mapCanvas)
{
    this->mMapCanvas = mapCanvas;
    this->isPaint = false;
    this->setZValue(-9.0);
    this->flg = false;
}

QRSAGSMapFlash::~QRSAGSMapFlash()
{

}

void QRSAGSMapFlash::clear()
{
    this->mMapLayers.clear();
}

void QRSAGSMapFlash::setLayers(QList<QgsMapLayer*> mapLayerList)
{
    this->mMapLayers.clear();
    this->mMapLayers = mapLayerList;
}

void QRSAGSMapFlash::setImage(QImage image)
{
    this->copyImage = image;
}

QList<QgsMapLayer *> QRSAGSMapFlash::getMapLayers()
{
    return this->mMapLayers;
}

void QRSAGSMapFlash::paint(QPainter *painter)
{
    if(this->mMapLayers.size() == 0){
        return;
    }

    int width = this->copyImage.width();
    int height = this->copyImage.height();
    QImage image = this->copyImage.copy(0,0, width, height);
    painter->drawImage(QRectF(0,0, width, height), image);
}

